package com.kmxd.ams.core.exception;

import javax.validation.constraints.NotNull;

/**
 * 用于业务提示
 *
 * @author ZuoLG
 */
public class LicenseException extends AbstractException {

  public LicenseException(
      @NotNull final LogInfo recordInfo, @NotNull String errorCode, String debugMessage) {
    super(recordInfo, errorCode, debugMessage);
    this.code = errorCode;
    this.debugMessage = debugMessage;
  }

  public LicenseException(@NotNull final LogInfo recordInfo, @NotNull String errorCode) {
    super(recordInfo, errorCode);
    this.code = errorCode;
  }

  public static LicenseException instance(@NotNull String errorCode) {
    return new LicenseException(LogInfo.newCallerInstance(), errorCode);
  }

  public static LicenseException instance(@NotNull String errorCode, String debugMessage) {
    return new LicenseException(LogInfo.newCallerInstance(), errorCode, debugMessage);
  }

  public static void throwException(@NotNull final LogInfo recordInfo, @NotNull String errorCode) {
    throw new LicenseException(recordInfo, errorCode);
  }

  public static void throwException(@NotNull String errorCode, String debugMessage) {
    throw new LicenseException(LogInfo.newCallerInstance(), errorCode, debugMessage);
  }
}
